import { get, postJSON } from '@/utils/request'
// 新鲜好物
export const getHomeNewGoodsList = (limit) => {
  return get('/home/new', { limit })
}

// 人气推荐
export const getHomeHotGoodsList = (limit) => {
  return get('/home/hot', { limit })
}

// 人气推荐
export const getHomeGoodsList = (limit) => {
  return get('/home/goods', { limit })
}

// 根据分类搜索
export const getCategorySubGoods = (id) => {
  return get('/category/sub/filter', { id })
}

// 商品搜索结果
export const getSearchAll = (searField) => {
  return postJSON('/category/goods/temporary', searField)
}

// 商品详情
export const getGoodsDetail = (id) => {
  return get('/goods', { id })
}

export const getGoodsStock = (id) => {
  return get(`/goods/stock/${id}`)
}

// 获取热榜数据
export const fetchHotGoodsApi = (id, type, limit = 3) => {
  return get('/goods/hot', { id, type, limit })
}

//猜我喜欢
export const goodsRelevant =()=>{
  return get('/goods/relevant')
}
